package com.whq.thrift.api.as.demo01.account.add;

import java.util.HashMap;
import java.util.Map;

import com.whq.common.StringUtil;
import com.whq.thrift.api.common.constants.CommonErrorCodeConstants;
import com.whq.thrift.api.common.thriftserver.ResponseBase;
import com.whq.thrift.api.thrift.as.service.service.ApiDetailInterface;
import com.whq.thrift.api.thrift.as.service.service.AsBaseSpringService;

public class ApiDetailImpl implements ApiDetailInterface {
	public ResponseBase execApi(AsBaseSpringService asBaseSpringService, String method, Map<String, String> params, Map<String, String> ctx) {
		String name = params.get("name");
		if (StringUtil.isBlank(name)) {
			return new ResponseBase(CommonErrorCodeConstants.ERR_CODE_LACK_PARAM, "缺少参数：name");
		}
		
		Map<String, String> parameter = new HashMap<String, String>(0);
		parameter.put("name", name);
		asBaseSpringService.getSqlSession().insert("User.inserRecord", parameter);
		
		return new ResponseBase(CommonErrorCodeConstants.ERR_CODE_SUCCESS);
	}

}
